﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Scheduler.aspx.cs" Inherits="Scheduler" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>وقت ملاقات</title>
    <link href="App_Themes/Default/css/styles.css" rel="stylesheet" type="text/css" />
    <link href="App_Themes/Default/css/B_Yekan.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .rsCustomAppointmentContainer div
        {
            width: 100% !important;
        }
        .rsCustomAppointmentContainer h2
        {
            overflow: hidden !important;
            white-space: nowrap !important;
            text-overflow: ellipsis !important;
            font-family:BYekan;
        }
    </style>
    <script language="javascript" type="text/javascript">
        function onSelectedIndexChanged(sender, eventArgs) {
            if (sender._value != "1") {
                alert("شما تنها اجازه انتخاب درخواست وقت ملاقات را دارید");
                sender._selectedIndex = 0;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadScheduler runat="server" ID="PatientScheduler" Width="100%" Height="100%"
            DataSourceID="PatientAppointmentsEntityDataSource" DataKeyField="Id" DataSubjectField="Subject"
            DataStartField="Start" DataEndField="End" FirstDayOfWeek="Saturday" HoursPanelTimeFormat="H:mm"
            LastDayOfWeek="Thursday" EditFormDateFormat="yyyy/dd/MM" Skin="Office2010Blue"
            EnableRecurrenceSupport="false" StartInsertingInAdvancedForm="false" StartEditingInAdvancedForm="false"
            OnAppointmentInsert="PatientScheduler_AppointmentInsert" OnAppointmentUpdate="PatientScheduler_AppointmentUpdate">
            <AdvancedForm Modal="true"></AdvancedForm>
            <AppointmentContextMenus>
                <%--The appointment context menu interaction is handled on the client in this example--%>
                <%--See the JavaScript code above--%>
                <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="ویرایش" Value="CommandEditAppointment" ImageUrl="App_Themes/Default/Images/edit.gif">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem IsSeparator="True">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="حذف" Value="CommandDelete" ImageUrl="App_Themes/Default/Images/delete.gif">
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadSchedulerContextMenu>
            </AppointmentContextMenus>
            <TimeSlotContextMenus>
                <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="وقت ملاقات جدید" ImageUrl="App_Themes/Default/Images/newAppointment.jpg"
                            Value="CommandAddAppointment">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem IsSeparator="true">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="برو به امروز" Value="CommandGoToToday">
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadSchedulerContextMenu>
            </TimeSlotContextMenus>
            <WeekView ColumnHeaderDateFormat="ddd, dd" />
            <ResourceTypes>
                <telerik:ResourceType KeyField="Id" Name="Patient" TextField="Name" ForeignKeyField="PatientId"
                    DataSourceID="PatientsEntityDataSource"></telerik:ResourceType>
                <telerik:ResourceType KeyField="Id" Name="DoctorAppointment" TextField="Name" ForeignKeyField="DoctorAppointmentId"
                    DataSourceID="DoctorAppointmentsEntityDataSource"></telerik:ResourceType>
                <telerik:ResourceType KeyField="Id" Name="AppointmentState" TextField="Name" ForeignKeyField="AppointmentStateId"
                    DataSourceID="AppointmentStatesEntityDataSource"></telerik:ResourceType>
            </ResourceTypes>
            <InlineInsertTemplate>
                <div id="qsfexAdvEditWrapper" dir="rtl">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label4" AssociatedControlID="SubjectTextBox" runat="server" CssClass="inline-label">عنوان: </asp:Label>
                            <br />
                            <asp:TextBox ID="SubjectTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="SubjectRequiredFieldValidator" runat="server" ValidationGroup="Insert"
                                ControlToValidate="SubjectTextBox" ErrorMessage="عنوان اجباری">*</asp:RequiredFieldValidator>
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label1" AssociatedControlID="PatientsComboBox" runat="server" CssClass="inline-label">نام و نام خانوادگی بیمار:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="PatientsComboBox" DataTextField="Name" DataValueField="Id"
                                Width="90%" Skin="Office2007" SelectedValue='<%# Bind("PatientId") %>' DataSourceID="PatientsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentStatesComboBox" runat="server"
                                CssClass="inline-label">وضعیت ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="AppointmentStatesComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" OnClientSelectedIndexChanged="onSelectedIndexChanged"
                                SelectedValue='<%# Bind("AppointmentStateId") %>' DataSourceID="AppointmentStatesEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label2" AssociatedControlID="DoctorAppointmentComboBox" runat="server"
                                CssClass="inline-label">ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="DoctorAppointmentComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("DoctorAppointmentId") %>'
                                DataSourceID="DoctorAppointmentsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label7" AssociatedControlID="StartTime" runat="server">از ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("Start") %>'>
                                <DateInput ID="StartDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="StartTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label6" AssociatedControlID="EndTime" runat="server">تا ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("End") %>'>
                                <DateInput ID="EndDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="EndTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                <asp:Image runat="server" ID="Image4" ValidationGroup="Insert" ImageUrl="App_Themes/Default/Images/ok.png"
                                    AlternateText="insert"></asp:Image></asp:LinkButton>
                            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Default/Images/cancel.png"
                                    AlternateText="cancel"></asp:Image></asp:LinkButton>
                        </div>
                    </div>
                </div>
            </InlineInsertTemplate>
            <InlineEditTemplate>
                <div id="qsfexAdvEditWrapper" dir="rtl">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label4" AssociatedControlID="SubjectTextBox" runat="server" CssClass="inline-label">عنوان: </asp:Label>
                            <br />
                            <asp:TextBox ID="SubjectTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="SubjectRequiredFieldValidator" runat="server" ValidationGroup="Insert"
                                ControlToValidate="SubjectTextBox" ErrorMessage="عنوان اجباری">*</asp:RequiredFieldValidator>
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label1" AssociatedControlID="PatientsComboBox" runat="server" CssClass="inline-label">نام و نام خانوادگی بیمار:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="PatientsComboBox" DataTextField="Name" DataValueField="Id"
                                Width="90%" Skin="Office2007" SelectedValue='<%# Bind("PatientId") %>' DataSourceID="PatientsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentStatesComboBox" runat="server"
                                CssClass="inline-label">وضعیت ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="AppointmentStatesComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("AppointmentStateId") %>'
                                DataSourceID="AppointmentStatesEntityDataSource" OnClientSelectedIndexChanged="onSelectedIndexChanged">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label2" AssociatedControlID="DoctorAppointmentComboBox" runat="server"
                                CssClass="inline-label">ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="DoctorAppointmentComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("DoctorAppointmentId") %>'
                                DataSourceID="DoctorAppointmentsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label7" AssociatedControlID="StartTime" runat="server">از ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("Start") %>'>
                                <DateInput ID="StartDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="StartTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label6" AssociatedControlID="EndTime" runat="server">تا ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("End") %>'>
                                <DateInput ID="EndDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="EndTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update">
                                <asp:Image runat="server" ID="Image4" ValidationGroup="Update" ImageUrl="App_Themes/Default/Images/ok.png"
                                    AlternateText="update"></asp:Image></asp:LinkButton>
                            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Default/Images/cancel.png"
                                    AlternateText="cancel"></asp:Image></asp:LinkButton>
                        </div>
                    </div>
                </div>
            </InlineEditTemplate>
            <AdvancedInsertTemplate>
                <div id="qsfexAdvEditWrapper" dir="rtl">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label4" AssociatedControlID="SubjectTextBox" runat="server" CssClass="inline-label">عنوان: </asp:Label>
                            <br />
                            <asp:TextBox ID="SubjectTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="SubjectRequiredFieldValidator" runat="server" ValidationGroup="Insert"
                                ControlToValidate="SubjectTextBox" ErrorMessage="عنوان اجباری">*</asp:RequiredFieldValidator>
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label1" AssociatedControlID="PatientsComboBox" runat="server" CssClass="inline-label">نام و نام خانوادگی بیمار:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="PatientsComboBox" DataTextField="Name" DataValueField="Id"
                                Width="90%" Skin="Office2007" SelectedValue='<%# Bind("PatientId") %>' DataSourceID="PatientsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentStatesComboBox" runat="server"
                                CssClass="inline-label">وضعیت ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="AppointmentStatesComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" OnClientSelectedIndexChanged="onSelectedIndexChanged"
                                SelectedValue='<%# Bind("AppointmentStateId") %>' DataSourceID="AppointmentStatesEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label2" AssociatedControlID="DoctorAppointmentComboBox" runat="server"
                                CssClass="inline-label">ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="DoctorAppointmentComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("DoctorAppointmentId") %>'
                                DataSourceID="DoctorAppointmentsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label7" AssociatedControlID="StartTime" runat="server">از ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("Start") %>'>
                                <DateInput ID="StartDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="StartTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label6" AssociatedControlID="EndTime" runat="server">تا ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("End") %>'>
                                <DateInput ID="EndDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="EndTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                <asp:Image runat="server" ID="Image4" ValidationGroup="Insert" ImageUrl="App_Themes/Default/Images/ok.png"
                                    AlternateText="insert"></asp:Image></asp:LinkButton>
                            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Default/Images/cancel.png"
                                    AlternateText="cancel"></asp:Image></asp:LinkButton>
                        </div>
                    </div>
                </div>
            </AdvancedInsertTemplate>
            <AdvancedEditTemplate>
                <div id="qsfexAdvEditWrapper" dir="rtl">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label4" AssociatedControlID="SubjectTextBox" runat="server" CssClass="inline-label">عنوان: </asp:Label>
                            <br />
                            <asp:TextBox ID="SubjectTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="SubjectRequiredFieldValidator" runat="server" ValidationGroup="Insert"
                                ControlToValidate="SubjectTextBox" ErrorMessage="عنوان اجباری">*</asp:RequiredFieldValidator>
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label1" AssociatedControlID="PatientsComboBox" runat="server" CssClass="inline-label">نام و نام خانوادگی بیمار:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="PatientsComboBox" DataTextField="Name" DataValueField="Id"
                                Width="90%" Skin="Office2007" SelectedValue='<%# Bind("PatientId") %>' DataSourceID="PatientsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentStatesComboBox" runat="server"
                                CssClass="inline-label">وضعیت ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="AppointmentStatesComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("AppointmentStateId") %>'
                                DataSourceID="AppointmentStatesEntityDataSource" OnClientSelectedIndexChanged="onSelectedIndexChanged">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label2" AssociatedControlID="DoctorAppointmentComboBox" runat="server"
                                CssClass="inline-label">ملاقات:</asp:Label>
                            <br />
                            <telerik:RadComboBox runat="server" ID="DoctorAppointmentComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("DoctorAppointmentId") %>'
                                DataSourceID="DoctorAppointmentsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label7" AssociatedControlID="StartTime" runat="server">از ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("Start") %>'>
                                <DateInput ID="StartDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="StartTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label6" AssociatedControlID="EndTime" runat="server">تا ساعت:</asp:Label>
                            <br />
                            <telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker" Width="90px"
                                SelectedDate='<%# Bind("End") %>'>
                                <DateInput ID="EndDateInput" runat="server" EmptyMessage=" " EnableSingleInputRendering="false" />
                                <TimePopupButton />
                                <TimeView ID="EndTimeView" runat="server" Columns="2" ShowHeader="true" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                                <DatePopupButton />
                            </telerik:RadTimePicker>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update">
                                <asp:Image runat="server" ID="Image4" ValidationGroup="Update" ImageUrl="App_Themes/Default/Images/ok.png"
                                    AlternateText="update"></asp:Image></asp:LinkButton>
                            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Default/Images/cancel.png"
                                    AlternateText="cancel"></asp:Image></asp:LinkButton>
                        </div>
                    </div>
                </div>
            </AdvancedEditTemplate>
            <AppointmentTemplate>
                <div class="rsCustomAppointmentContainer" dir="rtl" style="min-height: 40px; text-align: center;">
                    <h2>
                        <%# Eval("Subject") %>
                    </h2>
                    <br />
                    <div>
                        <telerik:RadComboBox runat="server" ID="DoctorAppointmentComboBox" DataTextField="Name"
                            DataValueField="Id" Width="90%" Skin="Office2007" Enabled="false" SelectedValue='<%# Bind("DoctorAppointmentId") %>'
                            DataSourceID="DoctorAppointmentsEntityDataSource">
                        </telerik:RadComboBox>
                    </div>
                </div>
            </AppointmentTemplate>
        </telerik:RadScheduler>
        <asp:EntityDataSource ID="PatientAppointmentsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="PatientAppointments" EnableDelete="True"
            EnableInsert="True" EnableUpdate="True" CommandText="" Where="(@PatientId is null || it.PatientId = @PatientId)"
            EnableFlattening="False">
            <WhereParameters>
                <asp:QueryStringParameter Name="patientId" QueryStringField="PatientId" DbType="Int32" />
            </WhereParameters>
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="AppointmentStatesEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="AppointmentStates">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="DoctorAppointmentsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" CommandText="            
            SELECT DoctorAppointment.Subject,[Room].Name+' '+ [Room].Address+' '+ [Doctor].LastName+' '+ [Doctor].FirstName as Name,
            [DoctorAppointment].Id as Id FROM 
            DatabaseEntities.DoctorAppointments as DoctorAppointment INNER JOIN
            DatabaseEntities.Doctors as Doctor ON 
            DoctorAppointment.DoctorId = Doctor.Id INNER JOIN
            DatabaseEntities.Rooms as Room ON 
            DoctorAppointment.RoomId = Room.Id">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="PatientsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" CommandText="SELECT it.[Id] , it.[FirstName] + ' ' + it.[LastName] as Name From DatabaseEntities.Patients as it">
        </asp:EntityDataSource>
    </div>
    </form>
</body>
</html>
